using System;
using System.Collections.Generic;
using System.Text;
using System.Management.Automation;
using System.Collections;

using PSSymbolStore;

namespace PSSymbolStore.Commands
{
    [Cmdlet(VerbsCommon.Get, "Symbols", SupportsShouldProcess = true)]
    public class GetSymbolsCommand : TransactionCommandBase
    {
        protected override bool CreateSymbolStore
        {
            get
            {
                return false;
            }
        }

        protected override void ProcessRecord()
        {
            try
            {
                List<Transaction> transactions = SymbolStoreObject.GetTransactions(TransactionId, true);
                if (transactions != null)
                {
                    foreach (AddTransaction transaction in transactions)
                    {
                        WriteObject(transaction.Files, true);
                    }
                }
            }
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "Error retrieving transaction", ErrorCategory.ReadError, TransactionId));
            }
        }
    }
}
